package com.ogilvy.audi.model;

import com.ogilvy.audi.model.BaseObject;
import org.apache.struts2.json.annotations.JSON;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * TblCircleAlbum entity. @author MyEclipse Persistence Tools
 */
@Entity
   @Table(name="TBL_CIRCLE_ALBUM")
   @org.hibernate.annotations.Table(appliesTo = "TBL_CIRCLE_ALBUM", comment = " 圈子相册表 ")
public class CircleAlbum extends BaseObject implements java.io.Serializable {

	// Fields

	private Long albumId;
	private String albumTitle;
	private String picDesc;
	private String picSmall;
	private String picBig;
	private Date crDate;
	private Long isApprove;
	private Long cmntNum;
	private Long favoritesNum;
	private Long pointNum;
	//private Long circleId;
	private String urlAddress;
	private Long userId;
	private String userName;
    private Integer version;
 /*      private CircleCategory circleCategory;
      private Set<CircleAcmnt> circleAcmnts=new HashSet<CircleAcmnt>();
*/	// Constructors

	/** default constructor */
	public CircleAlbum() {
	}

	/** full constructor */
	public CircleAlbum(String albumTitle, String picDesc, String picSmall,
                       String picBig, Date crDate, Long isApprove, Long cmntNum,
                       Long favoritesNum, Long pointNum, String urlAddress,
                       Long userId, String userName) {
		this.albumTitle = albumTitle;
		this.picDesc = picDesc;
		this.picSmall = picSmall;
		this.picBig = picBig;
		this.crDate = crDate;
		this.isApprove = isApprove;
		this.cmntNum = cmntNum;
		this.favoritesNum = favoritesNum;
		this.pointNum = pointNum;

		this.urlAddress = urlAddress;
		this.userId = userId;
		this.userName = userName;
	}

	// Property accessors

       @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
	public Long getAlbumId() {
		return this.albumId;
	}

	public void setAlbumId(Long albumId) {
		this.albumId = albumId;
	}
  @Column(length = 200)
	public String getAlbumTitle() {
		return this.albumTitle;
	}

	public void setAlbumTitle(String albumTitle) {
		this.albumTitle = albumTitle;
	}
   @Column(length = 200)
	public String getPicDesc() {
		return this.picDesc;
	}

	public void setPicDesc(String picDesc) {
		this.picDesc = picDesc;
	}
   @Column(length = 200)
	public String getPicSmall() {
		return this.picSmall;
	}

	public void setPicSmall(String picSmall) {
		this.picSmall = picSmall;
	}
 @Column(length = 200)
	public String getPicBig() {
		return this.picBig;
	}

	public void setPicBig(String picBig) {
		this.picBig = picBig;
	}
      @Column(length =8)
	@Temporal(value= TemporalType.TIMESTAMP)
    public Date getCrDate() {
        return crDate;
    }

    public void setCrDate(Date crDate) {
        this.crDate = crDate;
    }
 @Column()
    public Long getIsApprove() {
		return this.isApprove;
	}

	public void setIsApprove(Long isApprove) {
		this.isApprove = isApprove;
	}
 @Column(length = 200)
	public Long getCmntNum() {
		return this.cmntNum;
	}

	public void setCmntNum(Long cmntNum) {
		this.cmntNum = cmntNum;
	}
 @Column(length = 200)
	public Long getFavoritesNum() {
		return this.favoritesNum;
	}

	public void setFavoritesNum(Long favoritesNum) {
		this.favoritesNum = favoritesNum;
	}
 @Column(length = 200)
	public Long getPointNum() {
		return this.pointNum;
	}

	public void setPointNum(Long pointNum) {
		this.pointNum = pointNum;
	}

//	public Long getCircleId() {
//		return this.circleId;
//	}
//
//	public void setCircleId(Long circleId) {
//		this.circleId = circleId;
//	}
 @Column(length = 200)
	public String getUrlAddress() {
		return this.urlAddress;
	}

	public void setUrlAddress(String urlAddress) {
		this.urlAddress = urlAddress;
	}
  @Column(length = 200)
	public Long getUserId() {
		return this.userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}
 @Column(length = 200)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

           @Version
    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }/*
  @OneToMany(mappedBy = "circleAlbum", fetch = FetchType.LAZY)
   // @OrderBy("chapterNum")
    @BatchSize(size=50)
    public Set<CircleAcmnt> getCircleAcmnts() {
        return circleAcmnts;
    }

    public void setCircleAcmnts(Set<CircleAcmnt> circleAcmnts) {
        this.circleAcmnts = circleAcmnts;
    }

    @ManyToOne(targetEntity= CircleCategory.class,fetch = FetchType.LAZY,cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH})
    @JoinColumn(name="CIRCLE_ID",nullable=true)
    @ForeignKey(name="FK_ALBUM_CIRCLE_ID")
    @JSON(serialize=false)
    public CircleCategory getCircleCategory() {
        return circleCategory;
    }

    public void setCircleCategory(CircleCategory circleCategory) {
        this.circleCategory = circleCategory;
    }
*/
    @Override
    public String toString() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public boolean equals(Object o) {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public int hashCode() {
        return 0;  //To change body of implemented methods use File | Settings | File Templates.
    }
}